<script>
onload = function() {
  window.test_prop = 1;
  parent.tests[0].step(function() {parent.assert_equals(test_prop, 1)});
  document.open();
  document.write("<script>test_prop = 2;<\/script>");
  document.close();
  parent.tests[0].step(function() {parent.assert_equals(test_prop, 1)});
  parent.tests[1].step(function() {parent.assert_equals(window.test_prop, 2)});
  parent.tests[2].step(function() {parent.assert_equals(get_this(), window)});
  parent.tests_done();
};

function get_this() {
  return this;
}
</script>
